@header-height: 84px;
@tab-height: 32px;

header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: @header-height;
  background: var(--theme-lighter-bg);

  input[type=text] {
    border: none;
    border-bottom: 1px solid var(--theme-selection-bg);
  }

  div.balloon {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--theme-info);
    color: var(--theme-default-bg);
    box-shadow: 0 0 5px 5px rgba(0,0,0,0.1);
    z-index: 200;
    padding: 10px;

    a {
      margin: 10px;
      cursor: pointer;
    }
  }

  div.error {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    background-color: var(--theme-error);
    color: var(--theme-default-bg);
    box-shadow: 0 0 5px 5px rgba(0,0,0,0.1);

    p {
      margin: 0;
      padding: 5px 10px;
      white-space: pre;
      text-overflow: ellipsis;
      overflow: hidden;
      font-family: monospace;
      font-weight: bold;
    }
  }

  div.suggest {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    background-color: var(--theme-default-bg);
    box-shadow: 0 0 5px 5px rgba(0,0,0,0.1);

    ul {
      margin: 0;
      padding: 4px 0;
      list-style: none;
      user-select: none;

      li {
        padding: 4px 8px;
        cursor: default;

        &[active] {
          color: var(--theme-default-bg);
          background-color: var(--theme-default-fg);
        }

        &:hover {
          background-color: var(--theme-selection-bg);
        }
      }

      span.description {
        opacity: 0.7;
      }
    }
  }

  div.frame-header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    height: 24px;
    border-top: 1px solid var(--theme-selection-bg);
    box-sizing: border-box;
    overflow: hidden;
    user-select: none;

    > .handle {
      width: 5px;
      height: 100%;
      top: 0;
      position: absolute;
      transform: translateX(-2px);
      cursor: ew-resize;
    }

    > .base {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      -webkit-app-region: no-drag;
      background-color: var(--theme-lighter-bg);
      opacity: 0.3;
      cursor: ew-resize;
    }

    span {
      padding: 0 10px;
      font-size: 0.9em;
      line-height: 20px;
      cursor: default;
      display: inline-block;
      overflow: hidden;
      text-overflow: ellipsis;
      box-sizing: border-box;
      border-right: 1px solid var(--theme-selection-bg);

      &:last-child {
        border-right: none;
      }
    }
  }

  span {
    padding: 12px;
  }

  span.button {
    background: none;
    border: none;
    color: var(--theme-default-fg);
    cursor: pointer;

    i {
      line-height: 30px;
    }
  }
}

nav.frame-list {
  position: absolute;
  top: @header-height;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0;
  -webkit-app-region: drag;
  overflow-y: scroll;

  .padding {
    background-color: var(--theme-default-bg);
    background-size: 100% 100%;
    image-rendering: pixelated;
  }

  div.container {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    overflow: hidden;
  }

  div.frame {
    position: absolute;
    left: 0;
    right: 0;
    padding: 5px 0;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--theme-default-bg);
    border-right: 1px solid var(--theme-default-bg);
    box-sizing: border-box;
    cursor: default;

    &[active] {
      background-color: var(--theme-default-bg);
      color: var(--theme-default-fg);
      font-weight: bold;
    }

    div.header {
      width: 100%;
      white-space: nowrap;

      input[type=checkbox] {
        margin: 0 8px;
        padding: 0 6px;
        background-color: transparent;
        line-height: 8px;

        &:checked {
          background-color: var(--theme-default-bg);
        }
      }

      span.column {
        width: 100px;
        display: inline-block;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: 0;
        line-height: 20px;

        &:last-child {
          width: auto;
        }

        span.protocol {
          padding: 1px 8px;
          border-radius: 12px;
        }
      }
    }

    div.content {
      display: flex;
      width: 100%;
      flex-grow: 1;

      span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
    }
  }

  &::-webkit-scrollbar {
    background-color: var(--theme-lighter-bg);
    background-size: 100% 100%;
    image-rendering: pixelated;
  }

  &::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid var(--theme-default-bg);
  }
}

main {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;

  .detail-view {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    overflow-y: scroll;
    padding: 10px;
    border-top: 1px solid var(--theme-lighter-bg);
    border-left: 1px solid var(--theme-lighter-bg);
  }

  .tool-view {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid var(--theme-lighter-bg);

    .tab-container {
      position: absolute;
      top: 0;
      right: 0;
      left: 0;
      height: @tab-height;
      border-bottom: 1px solid var(--theme-lighter-bg);

      span {
        user-select: none;
        cursor: pointer;
        display: inline-block;
        line-height: 32px;
        padding: 0 20px;

        &[active] {
          background: var(--theme-lighter-bg);
        }
      }
    }

    .panel-container {
      position: absolute;
      top: @tab-height;
      right: 0;
      left: 0;
      bottom: 0;
    }

    .panel-wrapper {
      visibility: hidden;

      &[active] {
        visibility: visible;
      }
    }
  }

  ul {
    list-style: none;
    padding-left: 5px;

    &.metadata {
      padding: 0 25px;

      li {
        margin: 10px 0;
      }
    }

    details {
      margin: 2px;
    }

    summary.attribute {
      &::-webkit-details-marker {
        display: none;
      }
    }

    summary.layer {
      font-size: 1em;
      border-radius: 2px;
      padding: 5px;
      margin: 10px 0;
      transform: translateX(-5px);
      cursor: default;
      &::-webkit-details-marker {
        display: none;
      }

      &[active] {
        background-color: 1px solid var(--theme-default-fg);
        border: 1px solid var(--theme-default-fg);
        border-color: var(--theme-default-fg);
        color: var(--theme-default-fg);
        font-weight: bold;
      }

      span.protocol {
        padding: 1px 8px;
        margin: 0 8px;
        border-radius: 12px;
      }
    }

    details > summary {
      i.fa-circle-o {
        display: inline;
      }
      i.fa-arrow-circle-down, i.fa-arrow-circle-right {
        display: none;
      }
    }

    details > summary.children {
      i.fa-arrow-circle-right {
        display: inline;
      }
      i.fa-arrow-circle-down, i.fa-circle-o {
        display: none;
      }
    }

    details[open] > summary.children {
      i.fa-arrow-circle-right, i.fa-circle-o {
        display: none;
      }
      i.fa-arrow-circle-down {
        display: inline;
      }
    }

    li {
      padding-left: 5px;
      cursor: default;
      text-overflow: ellipsis;
      overflow: hidden;
    }

    span {
      opacity: 0.8;
      text-overflow: ellipsis;
    }

    span.label {
      min-width: 200px;
      margin: auto 10px;
      color: var(--theme-keywords);

      &.summary {
        color: var(--theme-classes);
      }

      &.error {
        color: var(--theme-error);
      }
    }
  }
}

.dialog {
  label {
    margin: 5px 0;
    display: block;
  }

  ul {
    list-style: none;
    padding: 0;
  }

  li {
    padding: 6px 0;
  }
}
